﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example17.aspx.cs" Inherits="Chapter03.Example17" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 3-17 在脚本中使用 class 属性</title>
</head>
<body>
    <form>
        <div>
            <a class="class1 class2" href="http://apress.com">Apress web site</a>
            <p />
            <a class="class2 otherclass" href="http://w3c.org">W3C web site</a>
            <script type="text/javascript">
                var elems = document.getElementsByClassName("otherclass");
                for (var i = 0; i < elems.length; i++) {
                    var x = elems[i];
                    x.style.border = "thin solid black";
                    x.style.backgroundColor = "white";
                    x.style.color = "black";
                }
            </script>
        </div>
    </form>
</body>
</html>
